﻿using System.Configuration;

namespace SaJiraSync.Config.Jira
{
    public sealed class JiraSection : ConfigurationSection
    {
        [ConfigurationProperty("login", IsRequired = true)]
        public LoginElement Login
        {
            get
            {
                return (LoginElement)this["login"];
            }
        }

        [ConfigurationProperty("search", IsRequired = true)]
        public SearchElement Search
        {
            get
            {
                return (SearchElement)this["search"];
            }
        }

        [ConfigurationProperty("openGrokServer", IsRequired = false)]
        public OpenGrokElement OpenGrokServer
        {
            get { return (OpenGrokElement)this["openGrokServer"]; }
        }

        [ConfigurationProperty("fields", IsRequired = true)]
        public FieldsElement Fields
        {
            get
            {
                return (FieldsElement)this["fields"];
            }
        }

        [ConfigurationProperty("resolvedStatuses", IsRequired = true, IsDefaultCollection = true)]
        [ConfigurationCollection(typeof(ResolvedStatusElementCollection), AddItemName = "resolvedStatus")]
        public ResolvedStatusElementCollection ResolvedStatuses
        {
            get
            {
                return (ResolvedStatusElementCollection)this["resolvedStatuses"];
            }
        }

        [ConfigurationProperty("fixedResolutions", IsRequired = true, IsDefaultCollection = true)]
        [ConfigurationCollection(typeof(FixedResolutionElementCollection), AddItemName = "fixedResolution")]
        public FixedResolutionElementCollection FixedResolutions
        {
            get
            {
                return (FixedResolutionElementCollection)this["fixedResolutions"];
            }
        }

        [ConfigurationProperty("actions", IsRequired = true)]
        public ActionsElement Actions
        {
            get
            {
                return (ActionsElement)this["actions"];
            }
        }

        [ConfigurationProperty("issueTypes", IsRequired = true)]
        public IssueTypesElement IssueTypes
        {
            get
            {
                return (IssueTypesElement)this["issueTypes"];
            }
        }

        [ConfigurationProperty("jiraServer", IsRequired = true)]
        public string JiraServer
        {
            get
            {
                return (string)this["jiraServer"];
            }
        }
    }
}